@config.main("CsQTL") {
    <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("bootstrap-submenu-3.0.0/dist/css/bootstrap-submenu.min.css")">

    <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("blast/css/blast.css")">

    <script src="@routes.Assets.versioned("blast/js/d3.v4.min.js")" type="text/javascript"></script>
    <script src="@routes.Assets.versioned("blast/js/qtl.js")" type="text/javascript"></script>
    <script src="@routes.Assets.versioned("bootstrap-submenu-3.0.0/dist/js/bootstrap-submenu.min.js")" type="text/javascript"></script>

    <style>


            .bootstrap-table .fixed-table-container .table thead th .th-inner{
                white-space: normal;
            }

    </style>


    <div class="body-box">
        <div class="page-box">

            @config.subTitle("CsQTL")

            <div class="main-body">

                <form class="registration-form col-sm-12 my-form" >
                    <div class="col-sm-12 form-group my-position">
                        <label class="col-sm-1 my-position-title"  >Trait:</label>
                        <div class="col-sm-8" style="text-align: left">

                            <select id="trait" style="width: 100%" onchange="ChangeQtl()"></select>
                        </div>
                    </div>
                </form>


                <div class="tab-pane in" id="barPlot" > </div>
                <table class="table table-hover" id="table">
                    <thead>
                        <tr>
                            <th data-field="qtlId" data-formatter="GetQtlId">QTL ID</th>
                            <th data-field="trait">Trait</th>
                            <th data-field="chr">Chr</th>
                            <th data-field="left">Start Position</th>
                            <th data-field="right">End Position</th>
                            <th data-field="length">Length</th>
                            <th data-field="m5c">m5C methylated mRNA</th>
                            <th data-field="m6a">m6A methylated mRNA</th>
                            <th data-field="total">total mRNA</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>

    <script>


            $(function () {

                $("#table").bootstrapTable()

                $.post("@routes.ToolsController.getAllTrait()", (data) => {
                    $("#trait").select2({data: data})
                    ChangeQtl()
                })
            })

            function ChangeQtl() {
                let trait = $("#trait").val()
                $.post("/capdb/tools/qtlData?tr=" + trait, (data) => {
                    $("#barPlot").empty();
                    let v = data.qtlPlot;
                    drawQtlBar(v.height, v.gen);
                    $('[data-toggle="popover"]').popover();


                    $("#table").bootstrapTable("load",data.qtlData)
                })
            }

            function GetQtlId(value, row) {
                return `<a href="/capdb/tools/qtlInfoPage?id=${row.id}" target="_blank">${value}</a>`
            }

    </script>
}